#ifndef __filter_H_
#define __filter_H_
#include "headfile.h"

typedef struct LowPassFilter{
    float out_last;
    char first_flag;
    float alpha;
} LowPassFilter;

extern struct LowPassFilter filter_r, filter_l, imu_Z_filter;
	
void init_low_pass_filter(LowPassFilter* filter, float fc, float Ts);
float apply_low_pass_filter(LowPassFilter* filter, float value);
void init_filters();
float process_right_channel(float value);
float process_left_channel(float value);
float process_imu_z(float value);
uint16 adc_mid(ADCN_enum a, ADCRES_enum c);
uint16 adc_ave(ADCN_enum a, ADCRES_enum c, uint8 N);
#endif